package com.zx.service.impl.dj;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zx.dao.dj.SaleRecordMapper;
import com.zx.model.dj.StockMaster;
import com.zx.service.dj.DataShowService;

/**
 * 
 * @author zx
 *
 */
@Service
public class DataShowServiceImpl implements DataShowService {

    @Autowired
    private SaleRecordMapper saleRecordMapper;

    /**
     * 件数
     * @param pageIndex
     * @param pageSize
     * @param orderType
     * @param sbrand
     * @param smodel
     * @param scolor
     * @param ssiz
     * @param shopname
     * @param createTime
     * @return
     */
    public List<StockMaster> selSaleRecordCondition(
            Integer pageIndex,Integer pageSize, int orderType,String sbrand,String smodel,
            String scolor,String ssiz,String shopname,String createTime){
        int startIndex = (pageIndex - 1)*pageSize;
        List<StockMaster> rst = saleRecordMapper.selSaleRecordCondition(
                startIndex, pageSize, orderType,sbrand,smodel,scolor,ssiz,shopname,createTime+"%");
        return rst;
    }
    
    /**
     * 总量
     * @param sbrand
     * @param smodel
     * @param scolor
     * @param ssiz
     * @param shopname
     * @param createTime
     * @return
     */
    public int selSaleRecordCount(String sbrand,String smodel,String scolor,String ssiz,String shopname,String createTime){
        
        int rst = saleRecordMapper.selSaleRecordCount(sbrand,smodel,scolor,ssiz,shopname,createTime+"%");
        return rst;
    }
}